package com.yanqu.road.server.cmd.wingroom.message;

import com.yanqu.road.pb.wingroom.WingRoomProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;
import io.netty.channel.ChannelHandlerContext;

/**
 * @author ：zfr
 * @date ：2022/3/19 23:10
 */
@Cmd(code = CrossProtocol.C_WING_ROOM_GET_MESSAGE_DETAIL_RESP, desc = "获取留言详情返回")
public class CrossGetMessageDetailRespCmd implements Command {
    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        WingRoomProto.GetMessageRespCrossMsg respCrossMsg = WingRoomProto.GetMessageRespCrossMsg.parseFrom(packet.getBytes());
        long guestServerId = respCrossMsg.getGuestServerId();
        long guestUserId = respCrossMsg.getGuestUserId();
        YanQuMessage message = YanQuMessageUtils.buildMessage(ClientProtocol.U_WING_ROOM_GET_MESSAGE_DETAIL, respCrossMsg.getRespMsg());
        MessageHelper.sendPacket(guestServerId, guestUserId, message);
    }
}
